//
//  waitworkViewController.m
//  shuilijuOASystem
//
//  Created by michael on 16/6/1.
//  Copyright © 2016年 czd. All rights reserved.
//

#import "waitworkViewController.h"
#import "ComingworkongController.h"

@interface waitworkViewController ()
@property (nonatomic,strong)NSArray* array;
@property (nonatomic,strong)NSArray* methodarray;

@end

@implementation waitworkViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    if ([_string isEqualToString:@"待办工作"]) {
     _array = [NSArray arrayWithObjects:@"待办发文",@"待办收文",nil];
     _methodarray = [NSArray arrayWithObjects:@"todoFwPage",@"todoSwPage",nil];

}
    if ([_string isEqualToString:@"在办工作"]) {
     _array = [NSArray arrayWithObjects:@"在办发文",@"在办收文",nil];
       _methodarray = [NSArray arrayWithObjects:@"tozbFwPage",@"tozbSwPage",nil];

}
    self.title = _string;
     self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
   UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStyleDone target:nil action:nil];
    self.navigationItem.backBarButtonItem = barButtonItem;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{
return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//       static NSString * cellIdentifier = @"cellIdentifier";
//            UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
//            if (cell == nil) {
//                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
//            }
    UITableViewCell *cell = [[UITableViewCell alloc]init];
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(15, 15, 40, 40)];
    image.image = [UIImage imageNamed: _array[indexPath.row]];
[cell.contentView addSubview:image];
//    cell.imageView.image = [UIImage imageNamed: _array[indexPath.row]];
    cell.imageView.size = CGSizeMake(30 ,30);
    UILabel *textLabel = [[UILabel alloc]init];
    textLabel.frame = CGRectMake(image.right+10, 5, 100, 60);
    textLabel.text = _array[indexPath.row];
    [cell.contentView addSubview:textLabel];
    UILabel  *label= [[UILabel alloc]initWithFrame:CGRectMake(45, 10, 15, 15)];
    label.backgroundColor = [UIColor redColor];
    label.layer.cornerRadius = 7;
    label.layer.masksToBounds = YES;
    label.textAlignment = NSTextAlignmentCenter;
//    label.font = [UIFont boldSystemFontOfSize:2.0];
    label.textColor = [UIColor whiteColor];
    
UIFont *font = [UIFont boldSystemFontOfSize:(10)];
label.font = font;
    [cell.contentView addSubview:label];

//    if (indexPath.row==0) {
//        label.text = self.read;
//        if ([self.read integerValue] !=0) {
//            label.hidden = NO;
//        }else{
//         label.hidden = YES;
//        }
//    }else{
//    label.hidden = YES;
//    
//    }


    
    
    
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 70;
}

- (void )tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

//if (indexPath.row==0) {
//    OAInBoxViewController *invc = (OAInBoxViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"inbox"];
//    [self.navigationController pushViewController:invc animated:YES];
//}
//if(indexPath.row==1) {
//    OASendMessageViewController *sendvc = (OASendMessageViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"send"];
//    [self.navigationController pushViewController:sendvc animated:YES];
//}

 ComingworkongController *comvc =(ComingworkongController *) [self.storyboard instantiateViewControllerWithIdentifier:@"comvc"];
 if (indexPath.row==0) {
    comvc.method = _methodarray[0];
    comvc.title = _array[0];
} if (indexPath.row==1) {
    comvc.method = _methodarray[1];
    comvc.title = _array[1                                                                                                                                                                                       ];
}
    [self.navigationController pushViewController:comvc animated:YES];


}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
